import tensorflow as tf

tf.compat.v1.disable_eager_execution()

#name给变量起名字
input1 = tf.constant([1.0, 2.0, 3.0], name='input1')
# The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.
# input2 = tf.Variable(tf.random_uniform([3]), name='input2')
input2 = tf.Variable(tf.random.uniform([3]), name='input2')
add = tf.add_n([input1, input2], name='addOP')

with tf.compat.v1.Session() as sess:
    sess.run(tf.compat.v1.global_variables_initializer())
    #定义存储位置，生成的图像
    writer = tf.compat.v1.summary.FileWriter("./logs.tmp.d/tensorboard1", sess.graph)
    print(sess.run(add))
    writer.close()
